package com.example.return1.confing;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.ReturnedMessage;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

/**
 * ClassName:MyReturnCallBack
 * Package:com.example.return1.confing
 * Description:
 *
 * @Author:ZhangXin
 * @Create:2023/8/14-15:31
 * @Version:v1.0
 */

/**
 * 写一个类实现接口
 */
@Component
@Slf4j
public class MyReturnCallBack implements RabbitTemplate.ReturnsCallback {
    @Override
    public void returnedMessage(ReturnedMessage returned) {
        log.error("消息从交换机没有正确的路由到(投递到)队列,原因为:{}",returned.getReplyText());
    }
}
